<?php
/**
 * Used to log user's events throughout the site
 *
 * @author Iain Edminster
 */
class Bliss_User_Plugin_Log extends Bliss_User_Plugin_Abstract
{
	protected $_table;

	protected function init()
	{
		$this->_table	= new Zend_Db_Table('user_logs');
	}

	public function log($message=null, $refMap=array())
	{
		if(isset($message)) {
			$refMap	= new Zend_Config($refMap);
			$this->_table->insert(array(
				'user_id'	=> $this->_user->id,
				'message'	=> $message,
				'ref_table' => $refMap->table,
				'ref_field' => $refMap->field,
				'ref_value' => $refMap->value
			));
		}
		return $this;
	}
}
?>
